//
//  VerticallyCenteredTextFieldCell.swift
//  SimpleCal
//
//  Created by 杜晓祥 on 2021/10/21.
//

import Foundation
import Cocoa

class VerticallyCenteredTextFieldCell: NSTextFieldCell {
    
    override func drawingRect(forBounds rect: NSRect) -> NSRect {
        var newRect:NSRect = super.drawingRect(forBounds: rect)
        let textSize = self.cellSize(forBounds: rect)
        let heightDelta = newRect.size.height - textSize.height
        if heightDelta > 0 {
            newRect.size.height = textSize.height
            newRect.origin.y += heightDelta * 0.5
        }
       // newRect.origin.x = -10
        return newRect
    }
}
